<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>color animate 02.</title>
    <link rel="stylesheet" href="../libs/jquery-easyui-1.4.2/themes/default/easyui.css">
    <script type="text/javascript" src="../libs/jquery/1.11.1/jquery.js"></script>
    <script type="text/javascript" src="../libs/jqueryui/1.11.4/jquery-ui-effect-color.js"></script>
    <script type="text/javascript" src="../libs/jquery-easyui-1.4.2/jquery.easyui.min.js"></script>

    <style>
        #div1 {
            background-color: blue;
            color: #ffffff;
            width: 500px;
        }
    </style>
    <script>
        $(function(){
            var state = true, state2 = true;
            $('#btn').click(function(){
                if(state){
                    $('#div1').animate({
                        backgroundColor: 'yellow',
                        color: '#000000',
                        width: 240
                    },1000);
                }else{
                    $('#div1').animate({
                        backgroundColor: 'blue',
                        color: '#ffffff',
                        width: 500
                    },1000);
                }
                state = !state;
            });
            //#E0ECFF
            $('#btn2').click(function(){
//                var tar = $('#dg').parents('div[class*="datagrid"]').find('div[class*="panel-header"]');
//                console.log('tar.length: ', tar.length);

                var panel = $('#dg').datagrid('getPanel');
                console.log( 'panel: ', panel );
                var panel_header = panel.panel('header');
                console.log( 'panel_header: ', panel_header );

                var tar = panel;

                if(state2){
                    tar.animate({
                        border: '3px solid red'
                    },1000);
                }else{
                    tar.animate({
                        border: '3px solid blue'
//                        backgroundColor: '#E0ECFF',
//                        background: '#E0ECFF',
                    },1000);
                }

                if(state2){
//                    tar.css('background-color', 'red');
                    tar.css('border', '3px solid red');
                }else{
//                    tar.css('background-color', 'yellow');
                    tar.css('border', '3px solid yellow');
                }

                state2 = !state2;
            });

            $('body').append('<br/>');
            $('body').append('<br/>');
            $('body').append('<div id="{1}"></div>'.replace('{1}','dg'));
            $('#dg').datagrid({
                title:'表格',
                width: 600,
                height: 200,
                singleSelect: true,
                columns:[[
                    {field:'code',title:'Code',width:'33%'},
                    {field:'name',title:'Name',width:'30%'},
                    {field:'price',title:'Price',width:'33%',align:'right'}
                ]]
            });
            var dgdata = [];
            for(var i=0;i<8;i++){
                var row = {};
                row['code']='code00'+(i+1);
                row['name']='name00'+(i+1);
                row['price']='1000'*(i+1);
                dgdata.push(row);
            }
            $('#dg').datagrid('loadData',dgdata);
        });
    </script>
</head>
<body>

    <div id="div1">
        你好,欢迎光临!请随意!窗前明月光,疑是地上霜.举头望明月,低头思故乡.日照香炉生紫烟,遥看瀑布挂前川.飞流直下三千尺,疑是银河落九天.
    </div>
    <br>
    <input type="button" id="btn" value="点击"/> &nbsp;&nbsp;
    <input type="button" id="btn2" value="点击"/>
    <!--<br>-->
    <!--<br>-->

</body>
</html>